package com.lwc.cfdns.exception;

import com.lwc.cfdns.enums.ResultCode;

/**
 * 搜索条件查不能数据时的异常处理
 *
 * @author luwc
 * @title NullDataOfSearchException
 * @description
 * @time 2023/5/30 09:13:02
 * @version: 1.0
 */
public class NullDataOfSearchException extends RuntimeException {
    private int code;
    private String message;

    public int getCode() {
        return code;
    }

    /**
     * 构造
     *
     * @param resultCode
     * @return null
     * @throws
     * @version 1.0.0
     * @author luwc
     * @time 2023/4/28 08:11:21
     */
    public NullDataOfSearchException(ResultCode resultCode) {
        super(resultCode.getMessage());
        this.code = resultCode.getCode();
        this.message = resultCode.getMessage();
    }

    /**
     * Constructs a new runtime exception with the specified detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     *
     * @param message the detail message. The detail message is saved for
     *                later retrieval by the {@link #getMessage()} method.
     */
    public NullDataOfSearchException(String message) {
        super(message);
        this.code = ResultCode.ERROR.getCode();
        this.message = message;
    }
}
